package com.example.demo.hellospringboot;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

/**
 * @author ChenYongHao
 * @date 2023/3/2 11:12
 * @desc springboot 认知
 */
@Controller
@RequestMapping("/hello")
public class HelloSpringBootController {
    @Autowired
    HttpServletRequest httpServletRequest;

    @GetMapping("/hello")
    @ResponseBody
    public  String getHelloWorld(){
        System.out.println("getRequestURL = " + httpServletRequest.getRequestURL());
        return "HelloWorld";
    }
}
